class TypeEventsController < ApplicationController
  # GET /type_events
  # GET /type_events.xml
  def index
    @type_events = TypeEvent.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @type_events }
    end
  end

  # GET /type_events/1
  # GET /type_events/1.xml
  def show
    @type_event = TypeEvent.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @type_event }
    end
  end

  # GET /type_events/new
  # GET /type_events/new.xml
  def new
    @type_event = TypeEvent.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @type_event }
    end
  end

  # GET /type_events/1/edit
  def edit
    @type_event = TypeEvent.find(params[:id])
  end

  # POST /type_events
  # POST /type_events.xml
  def create
    @type_event = TypeEvent.new(params[:type_event])

    respond_to do |format|
      if @type_event.save
        flash[:notice] = 'TypeEvent was successfully created.'
        format.html { redirect_to(@type_event) }
        format.xml  { render :xml => @type_event, :status => :created, :location => @type_event }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @type_event.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /type_events/1
  # PUT /type_events/1.xml
  def update
    @type_event = TypeEvent.find(params[:id])

    respond_to do |format|
      if @type_event.update_attributes(params[:type_event])
        flash[:notice] = 'TypeEvent was successfully updated.'
        format.html { redirect_to(@type_event) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @type_event.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /type_events/1
  # DELETE /type_events/1.xml
  def destroy
    @type_event = TypeEvent.find(params[:id])
    @type_event.destroy

    respond_to do |format|
      format.html { redirect_to(type_events_url) }
      format.xml  { head :ok }
    end
  end
end
